import javax.swing.*;
import java.awt.*;
import java.util.Scanner;
public class Main extends JFrame {
    public int start1=-1;
    public static void main(String[] args) {
        new Main();
    }
    public Main(){
        Scanner scanner = new Scanner(System.in);
        int width = Toolkit.getDefaultToolkit().getScreenSize().width;
        int height = Toolkit.getDefaultToolkit().getScreenSize().height;
        //将panel放入到thread中
        MyPanel panel = new MyPanel(width,height);
        scanner.close();
        new Thread(panel).start();
        //设置绑定监听器
        this.addKeyListener(panel);
        this.add(panel);
        //设置窗体关闭
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //窗体标题
        this.setTitle("法爷牌-坦克大战");
        //窗体大小不可变
        this.setResizable(false);
        //设置窗体位置
        width = (width - 1300) / 2;
        height = (height - 750) / 2;
        this.setBounds(width,height,1300,750);
        this.setBackground(Color.black);
        //设置窗体显示
        this.setVisible(true);

    }
}

